using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class POStockBillEntryMap : EntityTypeConfiguration<POStockBillEntry>
    {
        public POStockBillEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FBrNo, t.FInterID, t.FEntryID });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FNote)
                .HasMaxLength(255);

            this.Property(t => t.FBatchNo)
                .IsRequired()
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("POStockBillEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FQty).HasColumnName("FQty");
            this.Property(t => t.FPrice).HasColumnName("FPrice");
            this.Property(t => t.FAmount).HasColumnName("FAmount");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FAuxPrice).HasColumnName("FAuxPrice");
            this.Property(t => t.FAuxQty).HasColumnName("FAuxQty");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FCommitQty).HasColumnName("FCommitQty");
            this.Property(t => t.FAuxCommitQty).HasColumnName("FAuxCommitQty");
            this.Property(t => t.FBatchNo).HasColumnName("FBatchNo");
            this.Property(t => t.FKFDate).HasColumnName("FKFDate");
            this.Property(t => t.FKFPeriod).HasColumnName("FKFPeriod");
            this.Property(t => t.FDCSPID).HasColumnName("FDCSPID");
            this.Property(t => t.FSCSPID).HasColumnName("FSCSPID");
            this.Property(t => t.FAuxPropID).HasColumnName("FAuxPropID");
            this.Property(t => t.FSecCoefficient).HasColumnName("FSecCoefficient");
            this.Property(t => t.FSecQty).HasColumnName("FSecQty");
            this.Property(t => t.FSecCommitQty).HasColumnName("FSecCommitQty");
            this.Property(t => t.FSCStockID).HasColumnName("FSCStockID");
            this.Property(t => t.FDCStockID).HasColumnName("FDCStockID");
            this.Property(t => t.FPeriodDate).HasColumnName("FPeriodDate");
        }
    }
}
